// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   PartesAction.java

package org.fiel.struts.actions;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.fiel.commons.jdbc.*;
import org.fiel.helpers.Enums;
import org.fiel.persistence.InformacionPersistor;

// Referenced classes of package org.fiel.struts.actions:
//            FielAction

public class PartesAction extends FielAction
{

    public PartesAction()
    {
    }

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        String rol = obtenerRol(request);
        List resultados = getResultados(rol, Enums.TIPO_PARTES);
        request.getSession().setAttribute("partes", resultados);
        ActionForward retorno = mapping.findForward("listarPartes");
        return retorno;
    }

    protected List getResultados(String rol, Integer tipo)
    {
        Finder persistor = new InformacionPersistor();
        ArrayList ls = new ArrayList();
        ls.add(new Constraint("identipo", "=", tipo));
        ls.add(new FunctionInstrConstraint("nivel", rol));
        List resultados = persistor.FindAll(ls);
        return resultados;
    }
}
